//
//  TBSLoginTool.m
//  WeiXin
//
//  Created by wwj on 15/12/3.
//  Copyright © 2015年 wwj. All rights reserved.
//

#import "TBSLoginTool.h"
#import "NSString+Extend.h"

#define UserPerfenceUtilFile [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject] stringByAppendingPathComponent:@"account.data"]

@implementation TBSLoginTool

+(instancetype)sharedLoginTool{
    static TBSLoginTool *sharedClass;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedClass = [[TBSLoginTool alloc] init];
    });
    return sharedClass;
}

-(void)login{
   
}

-(void)loginOut{
    
}

-(void)saveUser:(UserModel *)user{
    if (user) {
        [NSKeyedArchiver archiveRootObject:user toFile:UserPerfenceUtilFile];
        [self login];
    }
}

-(UserModel *)getUser{
    return [NSKeyedUnarchiver unarchiveObjectWithFile:UserPerfenceUtilFile];
}

@end
